找传奇、传世资源到传世资源站!

jQuery+PHP+Mysql在线拍照和在线浏览照片

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

from clipboard <?phpdate_default_timezone_set("PRC"); //使用北京时间//只接受post请求if(strtolower($_SERVER['REQUEST_METHOD']) != 'post'){exit;}$folder = 'uploads/';$filename = date('YmdHis').rand().'.jpg';$original = $folder.$filename;$input = file_get_contents('php://input');if(md5($input) == '7d4df9cc423720b7f1f3d672b89362be'){exit;}$result = file_put_contents($original, $input);if (!$result) {echo '{"error":1,"message":"文件目录不可写";}';exit;}$info = getimagesize($original);if($info['mime'] != 'image/jpeg'){unlink($original);exit;}$origImage= imagecreatefromjpeg($original);$newImage= imagecreatetruecolor(154,110);imagecopyresampled($newImage,$origImage,0,0,0,0,154,110,520,370); //imagejpeg($newImage,'uploads/thumbs/'.$filename);imagejpeg($newImage,'uploads/small_'.$filename);//写入数据库include_once('connect.php');$time = mktime();$sql = "insert into photobooth (pic,uploadtime)values('$filename','$time')";$res = mysql_query($sql);if($res){ echo '{"status":1,"message":"Success!","filename":"'.$filename.'"}';}else{echo '{"error":1,"message":"Sorry,something goes wrong.";}';}?>

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复